﻿using Anke.SHManage.BLL;
using Anke.SHManage.MSSQLDAL.TJDAL;
using Anke.SHManage.Utility;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Anke.SHManage.Web.Reports
{
    public partial class DriverReportStationPrintModeWebForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Data_Binding();
            }
        }

        private void Data_Binding()
        {
            E_StatisticsPermisson em = UserOperateContext.Current.getMaxPerForStatistics();
            string selfWorkCode = UserOperateContext.Current.Session_UsrInfo.WorkCode;
            string selfCenterID = UserOperateContext.Current.Session_UsrInfo.P_Department.DispatchSubCenterID;
            string selfStationID = UserOperateContext.Current.Session_UsrInfo.P_Department.DispatchSationID;
            string start = Request.QueryString["Start"];
            string PickworkID = Request.QueryString["PickworkID"];
            string centerCode = Request.QueryString["CenterID"];
            string stationCode = Request.QueryString["StationID"];      
            //string start = "20151226";          
            //string stationCode = "026";
            
            this.ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/D_SRFLRBB.rdlc");
            //Microsoft.Reporting.WebForms.ReportParameter st = new Microsoft.Reporting.WebForms.ReportParameter("StartTime", start1);
            //Microsoft.Reporting.WebForms.ReportParameter ed = new Microsoft.Reporting.WebForms.ReportParameter("EndTime", end1);
            //this.ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { st, ed });
            TJDAL dal = new TJDAL();
            DataTable dt1 = dal.Get_TJ_SJRBBHZ(start, centerCode, stationCode, em, selfWorkCode, selfStationID, selfCenterID);
            this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetForD_SRFLRBB", dt1));
            this.ReportViewer1.LocalReport.Refresh();
        }
    }
}